package com.citrix.gs.util.common;

import java.net.URI;
import java.net.URISyntaxException;

public class CIInfo {
    
    @Override
    public String toString() {
        return String.format("[%s]http://%s:%s", type, host, port);
    }
    
    private CIType type;
    public CIType getType() {
        return type;
    }

    public CIInfo setType(CIType type) {
        this.type = type;
        return this;
    }
    private String host;
    private String port;
    private String username;
    private String password;
    
    public CIInfo() {
        
    }
    
    public CIInfo(String h, String p, String u, String pwd) {
        host = h;
        port = p;
        username = u;
        password = pwd;
        type = CIType.test;
    }
    
    public URI getURI(){
        
        try {
            return new URI(String.format("http://%s:%s", host, port));
        } catch (URISyntaxException e) {
            e.printStackTrace();
            return null;
        }
    }
    
    public String getHost() {
        return host;
    }
    public void setHost(String host) {
        this.host = host;
    }
    public String getPort() {
        return port;
    }
    public void setPort(String port) {
        this.port = port;
    }
    public String getUsername() {
        return username;
    }
    public void setUsername(String username) {
        this.username = username;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }

}
